// ==UserScript==
// @name           phpBB Ignore User Posts
// @namespace      http://glenncarr.com/greasemonkey/phpbb
// @description    Ignore/hide posts by specific users on a phpBBv3 board
// @include        http://www.fantasybaseballcafe.com/forums/viewtopic.php*
// @author         Glenn Carr (glenn at glenncarr dot com)
// $LastChangedRevision: 157 $
// $LastChangedDate: 2007-06-29 05:06:16 +0000 (Fri, 29 Jun 2007) $
// ==/UserScript==

var posts = document.evaluate("//div[contains(@class, 'post')]//dl[@class='postprofile']/dt/a", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
if ( posts.snapshotLength == 0 )
    return;

var ignoredUsers = GM_getValue( "users_to_ignore", "" );
GM_setValue( "users_to_ignore", ignoredUsers );
if ( ignoredUsers == "" )
    return;

ignoredUsers = ignoredUsers.split( /\s*,\s*/ );
var re = eval( '/' + ignoredUsers.join( '|' ) + '/' );

for ( var i = 0; i < posts.snapshotLength; i++ )
{
    var elUserLink = posts.snapshotItem( i );
    var elPost = elUserLink;
    while ( elPost != null )
    {
        var elPost = elPost.parentNode;
        if ( elPost != null && elPost.tagName == 'DIV' )
        {
            var className = elPost.getAttribute( 'class' );
            if ( /^post/i.test( className ) && re.test( elUserLink.innerHTML ) )
            {
				elPost.innerHTML = '[post by <b>' + elUserLink.innerHTML + '</b> hidden]';
                break;
            }
        }
    }
}

